Serial Port Device Driver
Sending;¬ Technical Information
¬

Technical Information Overview

This topic provides information on several aspects of the Serial Port Device Driver.  Information in this help topic, intended for users familiar with PC compatible serial hardware and terminology, is provided on the following subjects:

·	Troubleshooting
·	The Boot-Time Console Log
·	Device Driver Hierarchy
·	Recommended Serial Cabling
·	UART Characteristics
·	UART Programming

Troubleshooting

If you can't get your serial port working with your application, there could be a number of possible problems.  The following list may provide some hints to get you up and running.

1 -	Make sure that you have correctly configured every device driver you need to support your setup.

2 -	Verify that there are no resource conflicts.  If your system board provides serial ports that you are not using, make sure they are disabled so they don't interfere with Internal or PCMCIA Modems.

3 -	Boot OPENSTEP for Mach in verbose mode by typing "-v" at the boot prompt.  You should see a registration message for every serial port you have configured.  "The Boot-Time Console Log" section later in this help topic describes each bit of information presented.

4 -	If the port you are having problems with is a PCMCIA device that did not display a Boot-Time log (as discussed in step 3), then you may have selected a Port Address or IRQ Level that the PCMCIA device or adapter is not capable of supporting.  Most PCMCIA devices and adapters will work with the standard COM addresses and interrupts.

5 -	Make sure that cabling is correct.  Given the number of choices for connectors and handshaking, it is often difficult to get two devices talking without an RS-232 break-out box.  The section "Recommended Serial Cabling" (later in this help topic) provides proper wiring diagrams for common configurations.

6 -	Verify that the port is working by using a simple utility, such as tip, which is provided with OPENSTEP for Mach.  For more information on tip, type  man tip  in a terminal window.

The Boot-Time Console Log

When OPENSTEP for Mach boots, it probes each configured device driver.  The Serial Port Device Driver will provide several useful bits of information.  A successful probe will produce a message that looks something like:

Registering: ISASerialPort0
ISASerialPort0: Base=0x03f8, IRQ=4, Type=16550AF/C/CF, FIFO=16

Each instance of the Serial Port Device Driver is given a name of the form "ISASerialPort#", where # is replaced with the instance number for the port.  All messages logged to the Console will be prefixed with the instance name.

Registering: ISASerialPort0
The first line indicates that the port configuration went well and indicates the instance name.  The second line indicates several configuration details of the port.

ISASerialPort0: Base=0x03f8, IRQ=4, Type=16550AF/C/CF, FIFO=16
The device driver's instance name is followed by:
·	The "Base=" field indicates the address of this port.  It should match the Port Address assigned to this port in Configure.  If this port is a PCMCIA device, then the word "Base" will be preceded by "PCMCIA".
·	The "IRQ=" field indicates the interrupt this port uses.  It should match the IRQ Level assigned to this port in Configure.
·	The "Type=" field indicates the type of UART detected.  For more information about what this means, see the  "UART Characteristics" section.
·	The "FIFO=" field indicates the size of the UART's FIFO.  For more information about what this means, see the  "UART Characteristics" section (later in this help topic).

If something goes wrong during the probe, one of the following error messages will be seen instead of the two lines shown above:

ISASerialPort: Invalid Config Table
This indicates that the device driver was unable to read its own configuration table.  Correct this by running Configure.app, and removing and re-adding the offending device driver.  If the problem persists, try re-installing the Serial Port Device Driver package.

ISASerialPort0: Invalid configuration
This indicates that the device driver's configuration table didn't include the correct number of resources.  Correct this by running Configure.app and removing and re-adding the offending device driver. 

ISASerialPort0: Invalid Port configuration
This indicates that the Port Address specified in the device driver's configuration table was not acceptable.  The Port Address range must be 8 bytes long and start on an address that is a multiple of 8.  Correct this by running Configure.app and correcting the Port Address for the offending device driver. 

ISASerialPort0: Unable to determine chip type at I/O base 0x#
This indicates that the device driver was unable to detect a compatible UART at the Port Address given.  Verify that the address is correct, and make sure that the serial port hardware is jumpered correctly and enabled in the system's BIOS (if applicable).  Also, verify that the UART being used is in the list of compatible UARTs; see the "UART Characteristics" section, later in this help topic. 

ISASerialPort0: Unable to allocate callout entries
This indicates that the device driver was unable to allocate a necessary resource, which is an uncorrectable internal error.   Try re-installing the Serial Port Device Driver package.

ISASerialPort0: Unable to enable interrupts
This indicates that the device driver was unable to activate its IRQ, which is an uncorrectable internal error.   Try re-installing the Serial Port Device Driver package.

Device Driver Hierarchy

This device driver works in concert with several other software and hardware components.  This section provides a diagram to clarify the relationships between these components:
¬

Recommended Serial Cabling

Correct serial cables are essential for proper operation of the serial port and its attached devices.  In some cases, leaving flow control lines unconnected may cause a slight loss of performance.

The following designations are used for signal names and pin numbers:
¬
The following cable wiring diagrams are suggested for use with standard EIA-232 devices.  Consult the documentation provided with the hardware before using these diagrams:
¬
UART Characteristics

The type of chip that is used in serial ports is called a UART, which stands for Universal Asynchronous Receiver Transmitter.  There are several types of UARTs in common use today, but they are all backward compatible with the Intel i8250 used in the original IBM PC's Asynchronous Communications Adapter.

The Serial Port Device Driver will detect the type of UART that the serial port or modem uses and adjust its behavior accordingly.   The basic feature that effects the performance and behavior of the device driver is whether or not the UART has a FIFO. 

Older non-FIFO UARTs will not be able reliably to communicate at high speeds and present a greater burden on the CPU, as each character sent or received results in an interrupt.  Non-FIFO UARTs include the original i8250 family, the 16450, and the original 16550, which has a defective FIFO.  Non-FIFO UARTs will be reliable up to 9600 bps on all platforms, and 19200 bps should be reliable on most.

For high speed and multiple port communications, FIFO UARTs should be used.  The Serial Port Device Driver makes use of the 16 byte FIFO on the 16550 family (except the original chip, which had a defective FIFO).  If an ST16C650 is detected, the driver will adjust its FIFO control to optimize for the 16650's 32 byte FIFO.    UARTs with a FIFO should have no problem achieving 38400 bps and should reach 57600 bps on most platforms.

Because OPENSTEP for Mach is a multi-tasking operating system and places high demands on the system, it should be expected that occasionally, a character will be dropped.  Testing has shown this to be rare and should not effect normal operation of the port or the software using the port.

UART Programming

This section provides details of how the Serial Port Device Driver programs the UART (you should be familiar with the register interface and operation of standard PC compatible serial devices).

The Serial Port Device Driver enables chip interrupts when a port is opened.  All interrupt sources are enabled except for the MSR interrupt, as many serial implementations leave RI and/or DCD unconnected.  At the time that interrupts are enabled, a heartbeat timer is set which polls the Modem Status Register every 20ms (milliseconds).  This is a light load operation that shouldn't cause a noticeable performance loss.

If the UART has a usable FIFO, then the following table is used to determine the receive-FIFO threshold.  The values are chosen to allow the minimum number of interrupts while ensuring 2ms to respond to each interrupt, while not allowing more than 10ms character latency.

	bps:	16550 Level	16650 Level
	    50		1/16		 1/1
	   110		1/16		 1/1
	   134		1/16		 1/1
	   300		1/16		 1/1
	  1200		1/16		 1/1
	  2400		1/16		 8/32
	  4800		1/16		 8/32
	  7200		4/16		 8/32
	  9600		4/16		 8/32
	 19200		8/16		16/32
	 38400		8/16		24/32
	 57600		4/16		16/32
	115200		1/16		 8/32

¬

See also

·	The main "Serial Port" topic in Configure's on-line help for this device driver. 

·	The "Installing and Configuring the Serial Port Device Driver" topic in Configure's on-line help for this device driver. 

·	Configure's on-line help for the TTY Port Server Device Driver. 

·	Configure's on-line help for the Serial Mouse Device Driver. 

·	"Add a Device" in Configure's on-line help.

·	See NeXTAnswer 1824 for general information on installing and configuring device drivers.